﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="ImageDetail.aspx.vb" Inherits="Assignment_2___Prototype.ImageDetail" %>


<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style2
        {
            height: 157px;
        }
        #displayright
        {
            height: 19px;
        }
        .style4
        {
            height: 157px;
            width: 243px;
        }
        </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div>
        <div>
            <h2>
                Comments</h2>
            <div id="bluecontent" style="font-size: small; font-weight: normal; font-style: normal">
                <br />
            </div>
            <div>
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
                    Height="77px" PageSize="1" Width="362px" Style="margin-right: 4px">
                    <Columns>
                        <asp:ImageField DataAlternateTextField="ImageLink" DataImageUrlField="ImageLink"
                            HeaderText="***Image***">
                            <ControlStyle CssClass="parrotImageLarge" />
                            <FooterStyle CssClass="parrotImageLarge" />
                            <HeaderStyle Height="0px" />
                            <ItemStyle BorderStyle="None" CssClass="parrotImageLarge" />
                        </asp:ImageField>
                    </Columns>
                </asp:GridView>
            </div>

            <br />
            <br />

            <div>
                <div>

                <table>
                <tr>
                <td>
                <h2>Image Details</h2><br />
            <div class="displayleft">
                <asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource3" Height="139px"
                    Width="370px" BorderStyle="Solid">
                    <EditItemTemplate>
                        <strong>Description:</strong>
                        <asp:TextBox ID="ImageDescriptionTextBox" runat="server" Text='<%# Bind("ImageDescription") %>' />
                        <br />
                        <strong>Date Uploaded:</strong>
                        <asp:TextBox ID="DateUploadedTextBox" runat="server" Text='<%# Bind("DateUploaded") %>' />
                        <br />
                        <strong>Time Uploaded:</strong>
                        <asp:TextBox ID="TimeUploadedTextBox" runat="server" Text='<%# Bind("TimeUploaded") %>' />
                        <br />
                        <strong>Uploaded by:</strong> <a href="UserProfile.aspx?Username=<%# Eval("UserName") %>">
                            <asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' /></a>
                        <br />
                        <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
                            Text="Update" />
                        <asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
                            Text="Cancel" />
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        <strong>Description:</strong>
                        <asp:TextBox ID="ImageDescriptionTextBox0" runat="server" Text='<%# Bind("ImageDescription") %>' />
                        <br />
                        <strong>Date Uploaded:</strong>
                        <asp:TextBox ID="DateUploadedTextBox0" runat="server" Text='<%# Bind("DateUploaded") %>' />
                        <br />
                        <strong>Time Uploaded:</strong>
                        <asp:TextBox ID="TimeUploadedTextBox0" runat="server" Text='<%# Bind("TimeUploaded") %>' />
                        <br />
                        <strong>Uploaded by:</strong> <a href="UserProfileView.aspx?Username=<%# Eval("UserName") %>">
                            <asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' /></a>
                        <br />
                        <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
                            Text="Insert" />
                        &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False"
                            CommandName="Cancel" Text="Cancel" />
                    </InsertItemTemplate>
                    <ItemTemplate>
                        <strong>Description:</strong>
                        <asp:Label ID="ImageDescriptionLabel" runat="server" Text='<%# Bind("ImageDescription") %>' />
                        <br />
                        <br />
                        <strong>Date Uploaded:</strong>
                        <asp:Label ID="DateUploadedLabel" runat="server" Text='<%# Bind("DateUploaded") %>' />
                        <br />
                        <br />
                        <strong>Time Uploaded:</strong>
                        <asp:Label ID="TimeUploadedLabel" runat="server" Text='<%# Bind("TimeUploaded") %>' />
                        <br />
                        <br />
                        <strong>Uploaded by:</strong> <a href="UserProfileView.aspx?Username=<%# Eval("UserName") %>">
                            <asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' /></a>
                        <br />
                    </ItemTemplate>
                </asp:FormView>
               
            </div>
                </div>
                </td>

                
                <td class="style4">

                <h2>Image Likes</h2>
                <br />
                <br />
                <asp:Image ID="imgLike" runat="server" Height="35px" ImageUrl="~/Images/like.png"
                    Style="text-align: center" Width="55px" />
                <asp:Label ID="lblTotalCounts" runat="server" Text="Label" Font-Size="Medium" BorderStyle="Inset"
                    Width="53px"></asp:Label>
                <div class="replaceLikeButton">
                    <asp:Button ID="btnLike" runat="server" Height="33px" Style="text-align: left" Text="Like"
                        Width="109px" Font-Bold="True" Font-Italic="False" CssClass="buttons"  />
                </div>
            </div>
          
            <td>
                <h2> Image has been tagged as</h2> <br />
&nbsp;<asp:ListBox ID="ListBox1" runat="server" DataSourceID="SqlDataSource5" DataTextField="TagName"
                                            DataValueField="TagName" Height="99px" Width="269px" SelectionMode="Multiple"
                                            Font-Names="Calibri" Font-Size="Medium"></asp:ListBox>
            </td>

           
            </tr>
            </table>

            <div>
                <div>
                  
                    <table>

                    <tr>

                    <td class="style2">

                    <h2>Add a Comment</h2><br />
                    <div>
                        Enter your comment below and click comment.<div
                            class="commentTexBox">
                            <asp:TextBox ID="txtimagecomment" runat="server" BorderStyle="Solid" Height="77px"
                                Width="449px" TextMode="MultiLine"></asp:TextBox>
                            <br />
                            <br />
                            <asp:Button ID="btncomment" runat="server" Text="Comment" Width="123px" 
                                CssClass="buttons" Height="35px" style="margin-left: 150px"/>
                            <br />
                            <br />
                            </td>


                            <td class="style2"> 
                                <h2>Tag this Image</h2> <br />
                                <div class="tags">
                                    <asp:Panel ID="Panel1" runat="server" Height="76px" ScrollBars="Vertical" 
                                        Width="257px">
                                        <asp:CheckBoxList ID="cbxtags" runat="server" DataSourceID="SqlDataSource4" DataTextField="TagName"
                                            DataValueField="TagID" RepeatLayout="Flow">
                                        </asp:CheckBoxList>
                                 
                                    </asp:Panel>

                                    <div class="newTags">
                                        <br />
                                    To create a new tag, enter your tag and click Add.<br />
                                    <br />
                                    <asp:TextBox ID="txtnewtag" runat="server" Width="252px"></asp:TextBox>


                                    <td class="style2">
                                     <br />
                                    <br />
                                    <br />
                                     <asp:Button ID="btntagimage" runat="server" Height="48px" Text="Tag Image" 
                                        Width="135px" CssClass="buttons" style="margin-left: 9px" />
                    

                                        <asp:Button ID="btnaddnewtag" runat="server" Height="35px" Text="Add New Tag" 
                                        Width="131px" CssClass="buttons" style="margin-left: 8px; margin-top: 59px;" />
                                    </td>

                                    <br />
                                    </tr>

                                </div>
                                
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>





    <tr>

    <td>


    <br />


    <h2> Comments for this Image</h2>
    <br />
    <div>
        <asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource2">
            <AlternatingItemTemplate>
                <span style=""><strong>Comment:</strong> <span style="color: #3366FF">
                    <asp:Label ID="CommentBodyLabel" runat="server" Text='<%# Eval("CommentBody") %>' />
                </span>
                    <br />
                    <strong>Date Uploaded:</strong>
                    <asp:Label ID="DateUploadedLabel0" runat="server" Text='<%# Eval("DateUploaded") %>' />
                    <br />
                    <strong>Time Uploaded:</strong>
                    <asp:Label ID="TimeUploadedLabel0" runat="server" Text='<%# Eval("TimeUploaded") %>' />
                    <br />
                    <strong>Comment Posted by:</strong> <a href="UserProfileView.aspx?Username=<%# Eval("UserName") %>">
                        <asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' /></a>
                    <br />
                    <br />
                </span>
            </AlternatingItemTemplate>
            <EditItemTemplate>
                <span style=""><strong>Comment:</strong> <span style="color: #3366FF">
                    <asp:TextBox ID="CommentBodyTextBox" runat="server" Text='<%# Bind("CommentBody") %>' />
                </span>
                    <br />
                    <strong>Date Uploaded:</strong>
                    <asp:TextBox ID="DateUploadedTextBox1" runat="server" Text='<%# Bind("DateUploaded") %>' />
                    <br />
                    <strong>Time Uploaded:</strong>
                    <asp:TextBox ID="TimeUploadedTextBox1" runat="server" Text='<%# Bind("TimeUploaded") %>' />
                    <br />
                    <strong>Comment Posted by</strong> <a href="UserProfileView.aspx?Username=<%# Eval("UserName") %>">
                        <asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' /></a>
                    <br />
                    <asp:Button ID="UpdateButton0" runat="server" CommandName="Update" Text="Update" />
                    <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancel" />
                    <br />
                    <br />
                </span>
            </EditItemTemplate>
            <EmptyDataTemplate>
                <span>No data was returned.</span>
            </EmptyDataTemplate>
            <InsertItemTemplate>
                <span style=""><strong>Comment:</strong> <span style="color: #3366FF">
                    <asp:TextBox ID="CommentBodyTextBox0" runat="server" Text='<%# Bind("CommentBody") %>' />
                </span>
                    <br />
                    <strong>Date Uploaded:</strong>
                    <asp:TextBox ID="DateUploadedTextBox2" runat="server" Text='<%# Bind("DateUploaded") %>' />
                    <br />
                    <strong>Time Uploaded:</strong>
                    <asp:TextBox ID="TimeUploadedTextBox2" runat="server" Text='<%# Bind("TimeUploaded") %>' />
                    <br />
                    <strong>Comment Posted by:</strong> <a href="UserProfileView.aspx?Username=<%# Eval("UserName") %>">
                        <asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' /></a>
                    <br />
                    <asp:Button ID="InsertButton0" runat="server" CommandName="Insert" Text="Insert" />
                    <asp:Button ID="CancelButton0" runat="server" CommandName="Cancel" Text="Clear" />
                    <br />
                    <br />
                </span>
            </InsertItemTemplate>
            <ItemTemplate>
                <span style=""><strong>Comment:</strong> <span style="color: #3366FF">
                    <asp:Label ID="CommentBodyLabel0" runat="server" Text='<%# Eval("CommentBody") %>' />
                </span>
                    <br />
                    <strong>Date Uploaded:</strong>
                    <asp:Label ID="DateUploadedLabel1" runat="server" Text='<%# Eval("DateUploaded") %>' />
                    <br />
                    <strong>Time Uploaded:</strong>
                    <asp:Label ID="TimeUploadedLabel1" runat="server" Text='<%# Eval("TimeUploaded") %>' />
                    <br />
                    <strong>Comment Posted by:</strong> <a href="UserProfileView.aspx?Username=<%# Eval("UserName") %>">
                        <asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' /></a>
                    <br />
                    <br />
                </span>
            </ItemTemplate>
            <LayoutTemplate>
                <div id="itemPlaceholderContainer" runat="server" style="">
                    <span runat="server" id="itemPlaceholder" />
                </div>
                <div style="">
                </div>
            </LayoutTemplate>
            <SelectedItemTemplate>
                <span style="">CommentBody: <span style="color: #3366FF">
                    <asp:Label ID="CommentBodyLabel1" runat="server" Text='<%# Eval("CommentBody") %>' />
                </span>
                    <br />
                    DateUploaded:
                    <asp:Label ID="DateUploadedLabel2" runat="server" Text='<%# Eval("DateUploaded") %>' />
                    <br />
                    TimeUploaded:
                    <asp:Label ID="TimeUploadedLabel2" runat="server" Text='<%# Eval("TimeUploaded") %>' />
                    <br />
                    UserName: <a href="UserProfileView.aspx?Username=<%# Eval("UserName") %>">
                        <asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' /></a>
                    <br />
                    <br />
                </span>
            </SelectedItemTemplate>
        </asp:ListView>
        </td>
        </tr>
        </table>












        <asp:DataPager ID="DataPager1" runat="server" PagedControlID="ListView1" PageSize="4">
            <Fields>
                <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowNextPageButton="False"
                    ShowPreviousPageButton="False" />
                <asp:NumericPagerField />
                <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" ShowNextPageButton="False"
                    ShowPreviousPageButton="False" />
            </Fields>
        </asp:DataPager>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT Image_Comments.CommentBody, Image_Comments.DateUploaded, Image_Comments.TimeUploaded, aspnet_Users.UserName, Image_Comments.ImageID, Image_Comments.ImageCommentID FROM (Image_Comments INNER JOIN aspnet_Users ON Image_Comments.UserID = aspnet_Users.UserId) WHERE (Image_Comments.ImageID = ?) ORDER BY Image_Comments.ImageCommentID DESC">
            <SelectParameters>
                <asp:QueryStringParameter Name="?" QueryStringField="id" />
            </SelectParameters>
        </asp:SqlDataSource>
    </div>
                <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                    ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT Images.ImageDescription, Images.DateUploaded, Images.TimeUploaded, aspnet_Users.UserName, Images.ImageID FROM (Images INNER JOIN aspnet_Users ON Images.UserIDFK = aspnet_Users.UserId) WHERE (Images.ImageID = ?)">
                    <SelectParameters>
                        <asp:QueryStringParameter Name="?" QueryStringField="ID" />
                    </SelectParameters>
                </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
        ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT [ImageLink] FROM [Images] WHERE ([ImageID] = ?)">
        <SelectParameters>
            <asp:QueryStringParameter Name="ImageID" QueryStringField="id" Type="Int32" />
        </SelectParameters>
    </asp:SqlDataSource>
                                        
                                        <asp:SqlDataSource ID="SqlDataSource5" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                                            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="SELECT Tags.TagName, Image_Tags.ImageIDFK, Image_Tags.ID FROM (Tags INNER JOIN Image_Tags ON Tags.TagID = Image_Tags.TagIDFK) WHERE (Image_Tags.ImageIDFK = ?) ORDER BY Image_Tags.ID DESC">
                                            <SelectParameters>
                                                <asp:QueryStringParameter Name="?" QueryStringField="id" />
                                            </SelectParameters>
                                        </asp:SqlDataSource>
                                        <asp:SqlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                                            ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" 
                                            
                    SelectCommand="SELECT [TagID], [TagName] FROM [Tags] ORDER BY [TagID] DESC">
                                        </asp:SqlDataSource>
                                 
                                    
</asp:Content>
